package model;

import connection.DbConnection;
import java.sql.*;

public class ResponseImpl{
	static DbConnection conn = new DbConnection();
	/**
	 * 
	 * @param questionID
	 * @return an int array containing [timervalue, status]
	 */
	public int getResponses(int questionID){
		int ret = -1;
		PreparedStatement ps;
		try {
			System.out.println("here! getRespons");
			String sql = "SELECT NumberOfAnswer FROM Question WHERE QuestionID="+questionID;
			ps = conn.getConn().prepareStatement(sql);
			System.out.println("SQL:"+sql);

			ResultSet rs = ps.executeQuery();
			if(rs.next()){
				System.out.println("here! getResponse2");
				ret = rs.getInt(1);
			}
			ps.close();
		} catch (SQLException e) {
			e.printStackTrace();
			
		}
		
		return ret;
	}
}